﻿using Microsoft.Phone.Shell;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

namespace MyCities.Models
{
    public class DownloadClient
    {
        public static async Task<HttpResponseMessage> GetData(HttpClient client, string query)
        {
            // create client instance
            client.BaseAddress = new Uri("http://mycity.azurewebsites.net");

            // set JSON as default header
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            // Get request to get city object for Dublin
            HttpResponseMessage response = await client.GetAsync(query);

            // return response object
            return response;
        }
    }
}
